<template>
	<van-icon name="comment-o" /><a class="link-record" @click.stop="onClickHandler">{{componentModel.label}}({{count}})</a>
</template>

<script>
	import utils from '@/utils/utils.js';
	export default {
		name: "LinkRecordComponent",
		props: ["componentModel"],
		data() {
			return {
				count:0,
				currentId:""
			}
		},
		inject: ['children'],
		mounted() {
			this.children.push(this);
		},beforeUnmount() {
			utils.removeArrayElement(this.children,this);
		},
		methods: {
			setProp(prop) {
				for(var k in prop){
					if(k=="count"){
						this.count=prop[k];
					} else if (k == "currentId") {
						this.currentId = prop[k];
					}
				}
			},onClickHandler(){
				this.$store.state.userMain.$refs.mainPageContainer.name=this.componentModel.label;
				utils.getPageComponent(this).navigatePage(this.componentModel.refPageCode,
				{"action":"link","on":this.componentModel.model+"_id","value":this.currentId});
			}
		},
	}
</script>

<style>
	
</style>
